package com.chao.controller;

import com.chao.service.ContentService;
import com.chao.service.GoodsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@Slf4j
@RestController
public class GoodsController {


    @Autowired
    private GoodsService GoodsService;


    @GetMapping("/searchDB/{keyword}/{pageNo}/{pageSize}")
    public List<Map<String, Object>> searchDB(@PathVariable("keyword") String keyword,
                                            @PathVariable("pageNo") int pageNo,
                                            @PathVariable("pageSize") int pageSize) throws IOException {
         log.info("keyword:"+keyword);
         return GoodsService.searchPage(keyword, pageNo, pageSize);
    }
}
